package cn.truistic.enmicromsg.main;

import android.content.OperationApplicationException;
import android.os.RemoteException;
import android.view.View;
import android.widget.GridView;

import com.squareup.okhttp.Response;

import net.sqlcipher.database.SQLiteDatabase;

import java.util.List;
import java.util.Map;

import cn.truistic.enmicromsg.Message;
import cn.truistic.enmicromsg.bean.Contact;

/**
 * MainMVP接口
 */
public interface MainMVP {

    interface IMainView {}

    interface IHomeView {

        void onFailure(); //上传失败

        void onMessageFailure(); //聊天消息上传失败

        void uploadResponse();

        enum Progress {DETECT_WECHAT, DETECT_ROOT, DETECT_PERMISSION, REQUEST_DATA, ANALYSIS_DATA}

        enum State {UNDETECTED, DETECTING, TRUE, FALSE}

        void onDetectStop(int  isContact);

        void setProgressState(Progress progress, State state);
    }

    interface IGroupsView {

    }

    interface IExportView {

    }

    interface IMainPresenter {

    }

    interface IHomePresenter {
        void  detect(int  isContacts);
        boolean detectPermission();
        boolean detectRoot();

        String getUinStr();

        void uploadResponse();

        void onFailure(int courrPart);

        void onMessageFailure(int courrPart);

        void onUploadState(int courrPart);

        void showContactUnchanged();

    }


    interface IGroupsPresenter {

        void startActivity(Class cls );

    }


    interface IExportPresenter {
        void initView();

        void initEditText();

        void displayIPAndPhoneNumber();

        void initListener();

        void setDownloadedNumberToZero();

        void deleteContacts();

        int isInformationComplete();

        void initLoadUi();

        void downloadContactOnHTTPV2();

        void onUploadCompleteUI();

    }

    interface IHomeModel {
        IHomeView.State getState(IHomeView.Progress progress);

        void saveState(IHomeView.Progress progress, IHomeView.State state);

        int getDbNum();

        void saveDbNum(int num);

        String getDbPwd();

        void saveDbPwd(String pwd);

        void openMessageTable(SQLiteDatabase db); //获取聊天记录

        void openContactTable(SQLiteDatabase db);// 获取联系人

        //上传联系人
        void onContactsUpload(List<Contact> list);

        int  openUserInfoTable(SQLiteDatabase db);

        void onMessageUpload(List<Message> list);

    }

    interface IExportModel{
        void saveInfoToSharePreferences(String userName, String contactNumber, String password);

        String getPhoneDeviceSerial();

        String  getIPAddress();

        String getUserNameFromSharePreferences();

        String getPasswordFromSharePreferences();

        String getContactNumberFromSharePreferences();

        int getContactsCount();

        void deleteAllContacts();

        void deleteFewContacts();

        void addManyContact(Map<String, String> contacts) throws RemoteException ,OperationApplicationException;

        void upload(String url, String userName, String password, String phoneNumber, String localIPAddress, final String recNum ,String zylx );
    }


}